package jcer.core;

import java.nio.ByteBuffer;

public abstract class Task implements Runnable {
	protected Connection conn;
	protected int taskId;
	protected int taskNum;

	public abstract void decode(ByteBuffer buf) throws Exception;

	public abstract byte[] comsume();

	@Override
	public void run() {
		Result result = new Result();
		result.taskId = taskId;
		result.taskNum = taskNum;
		result.data = comsume();
		conn.addResult(result);
	}
}
